package cn.iocoder.yudao.module.xhyy.dal.mysql.book;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.xhyy.controller.app.book.vo.AppBookPageReqVO;
import cn.iocoder.yudao.module.xhyy.dal.dataobject.book.BookDO;
import cn.iocoder.yudao.module.xhyy.dal.dataobject.exam.ExamDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.xhyy.controller.admin.book.vo.*;

/**
 * 教材教辅 Mapper
 *
 * @author duanxinli
 */
@Mapper
public interface BookMapper extends BaseMapperX<BookDO> {

    default PageResult<BookDO> selectPage(BookPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BookDO>()
                .eqIfPresent(BookDO::getBookType, reqVO.getBookType())
                .eqIfPresent(BookDO::getGrade, reqVO.getGrade())
                .likeIfPresent(BookDO::getBookName, reqVO.getBookName())
                .orderByAsc(BookDO::getGrade));
    }
    default PageResult<BookDO> selectPage(AppBookPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BookDO>()
                .eqIfPresent(BookDO::getBookType, reqVO.getBookType())
                .eqIfPresent(BookDO::getGrade, reqVO.getGrade())
                .likeIfPresent(BookDO::getBookName, reqVO.getBookName())
                .orderByAsc(BookDO::getId));
    }

}